﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LeadExpress.Models;
using LeadExpress.Models.ViewPages;
using LeadExpress.Repository;
using LeadExpress.Utility;

namespace LeadExpress.Controllers
{
    public class HomeController : Controller
    {
        // Create an instance for repository
        HomeManagementRepository repository = new HomeManagementRepository();

        // Action Result
        public ActionResult Index()
        {
            HomeManagementModel model = new HomeManagementModel();

            NavigationConfig configCategory = new NavigationConfig();
            NavigationConfig configState = new NavigationConfig();

            configCategory = LeadTools.Deserialize(Server.MapPath(@"/Configs/CategoryListConfig.xml"), configCategory);
            configState = LeadTools.Deserialize(Server.MapPath(@"/Configs/StateListConfig.xml"), configCategory);

            model = repository.GetModel(configCategory, configState);

            return View(model);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
